<template>
    <div>
        <div class="form-section">
            <div class="form-item  form-item-style1">
                <div class="label-title">
                    <label>项目名称</label>
                </div>
                <div>
                    <p>{{detailData.ProjectName}}</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>项目经理</label>
                </div>
                <div>
                    <p>{{detailData.ItemManagerName}}</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>安全员</label>
                </div>
                <div>
                    <p>{{detailData.AqyName}}</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>测试电工</label>
                </div>
                <div>
                    <p>{{detailData.TestDG}}</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>工作电压</label>
                </div>
                <div>
                    <p>220V-380V</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>仪表名称</label>
                </div>
                <div>
                    <p>{{detailData.YBName}}</p>
                </div>
            </div>
            <div class="form-item form-item-style1">
                <div class="label-title">
                    <label>测试日期</label>
                </div>
                <div>
                    <p>{{detailData.TestDate}}</p>
                </div>
            </div>
        </div>
        <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3>工作接地</h3>
            <div v-for="(item,index) in detailData.dtConTestEleList_GZ"
                 :key="index">
                <div class="form-item  form-item-style1"
                     @click="openChild(item)">
                    <div class="label-title">
                        <label>{{index+1}}.设备名称及编号</label>
                    </div>
                    <div style="display:flex;align-items: center;">
                        <p>{{item.EquipmentName}}</p>
                        <x-icon type="ios-arrow-down"
                                fill="#999"
                                size="24"
                                v-show="!item.open"></x-icon>
                        <x-icon type="ios-arrow-up"
                                fill="#999"
                                size="24"
                                v-show="item.open"></x-icon>
                    </div>
                </div>
                <div class="form-section sectionML20"
                     style="border-bottom:1px solid #f4f4f4;"
                     v-show="item.open">
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>实测阻值</label>
                        </div>
                        <div>
                            <p>{{item.TestZz}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>季节系数</label>
                        </div>
                        <div>
                            <p>{{item.SeasonalXs}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>测试结果</label>
                        </div>
                        <div>
                            <p>{{item.TestResult}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>是否符合要求</label>
                        </div>
                        <div>
                            <p>{{item.IsPass}}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-section">
            <h3>重复接地</h3>
            <div v-for="(item,index) in detailData.dtConTestEleList_CF"
                 :key="index">
                <div class="form-item  form-item-style1"
                     @click="openChild(item)">
                    <div class="label-title">
                        <label>{{index+1}}.设备名称及编号</label>
                    </div>
                    <div style="display:flex;align-items: center;">
                        <p>{{item.EquipmentName}}</p>
                        <x-icon type="ios-arrow-down"
                                fill="#999"
                                size="24"
                                v-show="!item.open"></x-icon>
                        <x-icon type="ios-arrow-up"
                                fill="#999"
                                size="24"
                                v-show="item.open"></x-icon>
                    </div>
                </div>
                <div class="form-section sectionML20"
                     style="border-bottom:1px solid #f4f4f4;"
                     v-show="item.open">
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>实测阻值</label>
                        </div>
                        <div>
                            <p>{{item.TestZz}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>季节系数</label>
                        </div>
                        <div>
                            <p>{{item.SeasonalXs}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>测试结果</label>
                        </div>
                        <div>
                            <p>{{item.TestResult}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>是否符合要求</label>
                        </div>
                        <div>
                            <p>{{item.IsPass}}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-section">
            <h3>防雷接地</h3>
            <div v-for="(item,index) in detailData.dtConTestEleList_FL"
                 :key="index">
                <div class="form-item  form-item-style1"
                     @click="openChild(item)">
                    <div class="label-title">
                        <label>{{index+1}}.设备名称及编号</label>
                    </div>
                    <div style="display:flex;align-items: center;">
                        <p>{{item.EquipmentName}}</p>
                        <x-icon type="ios-arrow-down"
                                fill="#999"
                                size="24"
                                v-show="!item.open"></x-icon>
                        <x-icon type="ios-arrow-up"
                                fill="#999"
                                size="24"
                                v-show="item.open"></x-icon>
                    </div>
                </div>
                <div class="form-section sectionML20"
                     style="border-bottom:1px solid #f4f4f4;"
                     v-show="item.open">
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>实测阻值</label>
                        </div>
                        <div>
                            <p>{{item.TestZz}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>季节系数</label>
                        </div>
                        <div>
                            <p>{{item.SeasonalXs}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>测试结果</label>
                        </div>
                        <div>
                            <p>{{item.TestResult}}</p>
                        </div>
                    </div>
                    <div class="form-item  form-item-style1">
                        <div class="label-title">
                            <label>是否符合要求</label>
                        </div>
                        <div>
                            <p>{{item.IsPass}}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- <div class="cut-off-rule"></div>
        <div class="form-section">
            <h3>附件信息</h3>
            <div class="form-item form-item-style1">
                <div class="label-title label-title1">
                    <label>附件</label>
                </div>
                <div class="right-section">
                    <span>预览</span>
                    <x-icon type="ios-arrow-right"
                            size="20"
                            class="icon-right"></x-icon>
                </div>
            </div>
        </div> -->
        <myMenu></myMenu>
    </div>
</template>
<script>
import myMenu from '@/commonComponents/menu'
export default {
    name: 'CETestDetail2',
    data () {
        return {
            userInfo: {},
            detailData: {}
        }
    },
    components: {
        myMenu
    },
    created () {
        this.userInfo = JSON.parse(localStorage.getItem('userInfo')) || {}
        this.getDetail()
    },
    methods: {
        openChild (item) {
            this.$set(item, 'open', !item.open)
        },
        getDetail () {
            let params = {
                'allowPaging': true,
                'business': 'GetConEleTestRecord',
                'data': {
                    'BusinessType': '2', // --业务类型参数  "2": 施工用电测试记录详细;
                    'Id': this.$route.query.id,
                    'TestType': '临时用电接地电阻测试' // --测试记录类型
                },
                'pageIndex': 0,
                'pageSize': 0,
                'tokenId': '',
                'userId': this.userInfo.userid
            }
            this.$axiosAjax.getConfigJson(params).then(res => {
                if (res.data.code === 0) {
                    this.detailData = res.data.data
                }
            }).finally(() => {
                this.$vux.loading.hide()
            })
        }
    }
}
</script>
<style scoped>
.sectionML20 {
    margin-left: 20px;
}
</style>
